package com.ibm.risk.irmp.base.service.client.config;

import com.ibm.risk.irmp.base.service.client.UserSessionStoreServiceClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;

@Slf4j
@Configuration
@ConditionalOnProperty(value = "app.irmp.common.auth.session-type", havingValue = "service", matchIfMissing = false)
public class UserSessionClientConfig extends AbstractBaseClientConfig {

    @Bean
    public UserSessionStoreServiceClient userSessionStoreServiceClient(){
        log.info("UserSessionStore is service");
        HttpServiceProxyFactory factory = getHttpServiceProxyFactory();
        return factory.createClient(UserSessionStoreServiceClient.class);
    }
}
